<html>
<script>

  async function installServiceWorker() {
    try {
      await navigator.serviceWorker.register('/?file=empty_worker.js');
      await navigator.serviceWorker.ready;
      return true;
    } catch {
      return false;
    }
  }

  async function updateServiceWorker() {
    try {
      const registrations = await navigator.serviceWorker.getRegistrations();
      await registrations[0].update();
      return true;
    } catch {
      return false;
    }
  }

  async function hasServiceWorker() {
    const registrations = await navigator.serviceWorker.getRegistrations();
    return registrations.length > 0;
  }

</script>
<body>
  This page is used to test creation, update and deletion service workers.
</body>

</html>